package com.kum.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.kum.domain.entity.SysFaceData;
import com.kum.mapper.SysFaceDataMapper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @version V1.0
 * @Package com.kum.service
 * @auhter 枯木Kum
 * @date 2021/3/9-6:26 PM
 */

@Service
public class SysFaceDataService {
    @Resource
    private SysFaceDataMapper sysFaceDataMapper;

    public SysFaceData findById(int id){
     return sysFaceDataMapper.selectById(id);
    }
    public SysFaceData findByUserId(int userId){
        QueryWrapper<SysFaceData> wrapper = new QueryWrapper<>();
        wrapper.eq("user_id",userId);
        return sysFaceDataMapper.selectOne(wrapper);
    }

    public void save(SysFaceData sysFaceData){
        if(sysFaceData.getId() == null){
            System.out.println(sysFaceData);
            sysFaceDataMapper.insert(sysFaceData);
            return;
        }
        sysFaceDataMapper.updateById(sysFaceData);
    }




}
